<?php

namespace Apps\AppApi\Method\Search;


use Apps\Common\Enum\SearchDataType;
use Apps\Common\Libs\PicUrl;
use PhalconPlus\Api\Common\ResultStatus;

class Quick extends BaseSearch
{
    private $limit = 5;
    public function run()
    {
        $keyword = $this->getDataItem('keyword');
        $city_code = $this->getDataItem('city_code');

        $cityId = $this->getCityId($city_code);

        if(empty($keyword)) {
            return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, '搜索关键字不能为空！');
        }
        if($cityId == 0) {
            return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, '城市代码错误或城市未开通！');
        }

        $this->setResult([
            'activity' => $this->searchActivity($cityId, $keyword),
            'beauty_parlor' => $this->searchBP($keyword),
            'beauty_parlor_service' => $this->searchBPS($keyword),
            'question' => $this->searchQuestion($keyword)
        ]);

    }
}